<template>
    <view class="question-wrapper">
		<!-- 轮播图区域 -->
		<swiper
			class="swiper"
			indicator-dots="true"
			autoplay="true"
			interval="3000"
			duration="500"
			@change="onSwiperChange"
		>
			<block v-for="(item, index) in newsList" :key="index">
				<swiper-item>
					<view class="swiper-item" @tap="goToNewsDetail(item)">
						<image :src="item.image" class="slide-image" />
						<view class="slide-title">{{ item.title }}</view>
					</view>
				</swiper-item>
			</block>
		</swiper>
        <!-- 直接展示刷题功能区，去除了页签菜单切换 -->
        <view v-show="true" class="tab-content"> <!-- 刷题 -->
            <view class="practice-section">
                <view class="section-title">刷题模式</view>
                <view class="section-description">进入刷题，提升知识点掌握程度</view>
                <view class="button" @tap="startPractice">开始刷题</view>
            </view>
        </view>

        <!-- 直接展示咨询功能区，去除了页签菜单切换 -->
        <view v-show="true" class="tab-content"> <!-- 咨询 -->
            <view class="consultation-section">
                <view class="section-title">咨询服务</view>
                <view class="section-description">如果有问题，可以联系老师或其他同学</view>
                <view class="button" @tap="startConsultation">开始咨询</view>
            </view>
        </view>


    </view>
</template>

<script>
export default {
    data() {
        return {
            // 当前选中的底部导航栏项目
            currentNav: 'home',
            // 相关资讯数据
            newsList: [
                { title: '最新教育政策解读', image: 'https://gd-hbimg.huaban.com/b1ffd0091134eed142df32dfc17fae4afd7bd5dd3d976-FttDPN_fw480webp' },
                { title: '2025年高考动态', image: 'https://gd-hbimg.huaban.com/3e87a0cdaa4a0922f1058042785db1fac4a187677874c-mwNWBh_fw480webp' },
                { title: '如何高效复习？', image: 'https://gd-hbimg.huaban.com/2ecb4945366083026172ba59da0d46600ecfcef3562b4-FQpCvc_fw480webp' },
                { title: '教育行业的未来趋势', image: 'https://gd-hbimg.huaban.com/20c6feabea7f8992a3f205900f7cc64d337abc0317c1b-qfE2Wx_fw480webp' }
            ]
        };
    },
    onShow() {
    	// 移除登录检查，首页不需要登录
    },
    methods: {
        // 开始刷题
        startPractice() {
            uni.navigateTo({
                url: '/pages/subject/index' // 跳转到刷题页面
            });
        },
        // 开始咨询
        startConsultation() {
            uni.navigateTo({
                url: '/pages/consultation/index' // 跳转到咨询页面
            });
        },
        // 跳转到主页
        goToHome() {
            this.currentNav = 'home';
        },
        // 跳转到经验圈
        goToExperience() {
            // this.currentNav = 'experience';
			uni.navigateTo({
				url:'/pages/experience/experience'//跳转至经验圈
			})
        },
        // 跳转到个人主页
        goToProfile() {
            uni.navigateTo({
                url: '/pages/index/index' // 跳转到个人主页
            });
        },
		// 跳转到资讯详情页
		goToNewsDetail(newsItem) {
			uni.navigateTo({
				url: `/pages/newsDetail/index?news=${JSON.stringify(newsItem)}`
			});
		},
		onSwiperChange(event) {
			// console.log('Swiper changed to:', event.detail.current);
		}
    }
}
</script>

<style>
.question-wrapper {
    background: linear-gradient(135deg, rgba(170, 207, 252, 1) 0%, rgba(187, 208, 251, 1) 50%, rgba(178, 236, 248, 1) 100%);
    padding-bottom: 50rpx;
    /* 使内容区域可滚动，避免被底部导航栏遮挡 */
    height: calc(100vh - 60rpx);
    overflow-y: auto;
}

.tab-content {
    padding: 30rpx;
}

.practice-section,
.consultation-section,
.experience-section {
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 20rpx;
    padding: 30rpx;
    margin-bottom: 20rpx;
    box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 36rpx;
    color: #333333;
    font-weight: bold;
}

.section-description {
    font-size: 28rpx;
    color: #666666;
    margin-top: 10rpx;
}

.button {
    margin-top: 20rpx;
    padding: 20rpx;
    background-color: #5983ff;
    border-radius: 10rpx;
    color: white;
    font-size: 32rpx;
    text-align: center;
    cursor: pointer;
}

/* 底部导航栏样式 */
.fixed-footer-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: #ffffff;
    border-top: 2rpx solid #eeeeee;
    padding: 10rpx 0;
    position: fixed;
    bottom: 0;
    width: 100%;
}

.nav-item {
    flex: 1;
    text-align: center;
    padding: 10rpx;
    cursor: pointer;
}

.nav-text {
    font-size: 30rpx;
    color: #333333;
}

/* 导航栏选中效果样式 */
.nav-item-active {
    color: #5e59ff;
    font-weight: bold;
}

.nav-item:hover {
    color: #5e59ff; /* 悬停效果 */
}

.swiper {
    width: 100%;
    height: 300rpx; /* 根据需要调整高度 */
}
 
.swiper-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}
 
.slide-image {
    width: 100%;
    height: 200rpx; /* 根据需要调整图片高度 */
    object-fit: cover;
    border-radius: 10rpx;
}
 
.slide-title {
    margin-top: 10rpx;
    font-size: 28rpx;
    color: #333;
    text-align: center;
}

</style>